import Vue from "vue";
import Vuex from "vuex";
// import login from "./login.js";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    isCollapse: false,
    token:sessionStorage.getItem('token')?sessionStorage.getItem('token'):''
  },
  mutations: {
    openLeftMenu: function(state) {
      state.isCollapse = !state.isCollapse;
    },
    changeLogin (state, user) {
      state.token = user.token;
      sessionStorage.setItem('token', user.token);
    }
  },
  getters: {
    getIsCollapse(state) {
      return state.isCollapse;
    }
  },
  actions: {
    openMenu: function({ commit }) {
      commit("openLeftMenu");
    }
  } /* ,
  modules: {
    login
  } */
});
// export default store
